import { createReducer } from 'redux-immutablejs'
import Immutable from 'immutable'

import {
	REQUEST_CHANNELS,
	RECEIVE_CHANNELS
} from './actions'

const initialState = Immutable.fromJS({
  datas:[],
  isChannelsFetching: true
})

export default createReducer(initialState, {
	[REQUEST_CHANNELS]: (state, action) => state.merge({
		isChannelsFetching: true
	}),
	[RECEIVE_CHANNELS]: (state, action) => state.merge({
		datas: action.channels
	})
})

